package testenv.model.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import testenv.model.AbstractBaseEntity;



@Entity
@SequenceGenerator(name="element_id_seq", sequenceName="element_id_sequence")
public class Element extends AbstractBaseEntity {
	private static final long serialVersionUID = 1L;
	
	
	public Element() {
	}
	
	public Element(String elementName, StructureElementGroup structureElementGroup) {
		this.elementName = elementName;
		this.structureElementGroup = structureElementGroup;
	}
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="element_id_seq")
	@GenericGenerator(
	     name="element_id_seq",
	     strategy="sequence",
	     parameters= {
	         @Parameter(name="minvalue", value="1"),
	         @Parameter(name="increment", value="1"),
	         @Parameter(name="sequence", value="element_id_sequence")
	         })
	private Integer id = null;
	
	@Column(nullable=false, length=50)
	private String elementName = null;
	
	
	@ManyToOne
	private StructureElementGroup structureElementGroup = null;
	
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getElementName() {
		return elementName;
	}

	public void setElementName(String elementName) {
		this.elementName = elementName;
	}

	public StructureElementGroup getStructureElementGroup() {
		return structureElementGroup;
	}

	public void setStructureElementGroup(StructureElementGroup structureElementGroup) {
		this.structureElementGroup = structureElementGroup;
	}
	
	
	
}
